import threading
# import Queue

import thread, time
def run(name,n):
  for i in range(n):
    time.sleep(1)
    print name,i
    thread.exit()

for i in range(10):
#   thread.start_new(run,(i,10))
  t = threading.Thread(target=run,args=(i,10),name=i)
  t.setDaemon(True)
  t.start()
  
print threading.enumerate()
time.sleep(5)
print threading.enumerate()
for i in threading.enumerate():
#   print i.getName(),"name"
#   if i.getName() == 6:
  print i.getName(),"exit"
  thread.exit()
print threading.enumerate()
time.sleep(5)

# queue = Queue.Queue(-1)
# # result = None
# def affiche():
#   queue.put("ble")
# #   result = "ble"
# a = threading.Thread(target=affiche,args=())
# a.start()
# while queue.qsize() == 0:
# # while result == None:
#   pass
# print result
